const path = require('path')
const fs = require('fs')

const outputHmlt = require('../dist/autoLandingPage.js')

// 生成write Stream
function createWriteStream(fileName) {
  const fullFileName = path.join(__dirname, fileName)
  const writeStreame = fs.createWriteStream(fullFileName, {
    flags: 'w'
  })
  return writeStreame
}

const writeSream = createWriteStream('/release/example01.html')

const options = {
  title: 'auto-langding-page',
  backgroundColor: '#09083c',
  frameName: 'innerContentBtn',
  frameOptions: {
    style: {
      btnHeight: 50,
      paddingBotom: true 
    },
    html: {
      bgImg: '../assets/bg.png',
      btnImg: '../assets/btn.png'
    },
    // js: { btnTop: (880 / 1134 * 100).toFixed(2) + '%' }
    js: { btnTop: '1020px' }
  }
}

const main = async () => {
  const html = await outputHmlt(options)
  writeSream.write(html)
} 
main()
